package auth_enum

import "strings"

// 权限系统枚举

//------------------------------------------ HTTP METHOD
type HTTP_METHOD int

const (
	GET HTTP_METHOD = iota + 1
	POST
	PUT
	DELETE
)

func GetHttpMethod(httpMethod string) HTTP_METHOD {
	if httpMethod == "" {
		panic("not support httpMethod")
	}
	switch strings.ToUpper(httpMethod) {
	case "POST":
		return POST
	case "GET":
		return GET
	case "PUT":
		return PUT
	case "DELETE":
		return DELETE
	default:
		panic("not support httpMethod")
	}
}

func GetHttpMethodStr(httpMethod HTTP_METHOD) string {
	switch httpMethod {
	case GET:
		return "GET"
	case POST:
		return "POST"
	case PUT:
		return "PUT"
	case DELETE:
		return "DELETE"
	default:
		panic("un support type")
	}
}
